

namespace gen {

	template <typename InfoT>
    template <typename GeneratorT>
    inline format<InfoT> & 
	format<InfoT>::operator=(GeneratorT const& g)
    {
        ptr.reset(new concrete_generator<GeneratorT, context_t>(g));
        return *this;
    }

	template <typename InfoT>
    inline format<InfoT>& 
	format<InfoT>::operator=(format const& f)
    {
        ptr.reset(new concrete_generator<format, context_t>(f));
        return *this;
    }

	template <typename InfoT>
    inline format<InfoT>
	format<InfoT>::copy() const
    {
        return format<InfoT>(ptr.get() ? ptr->clone() : 0);
    }
 
    template <
        typename DerivedT,       // derived class
        typename EmbedT,         // how derived class is embedded
        typename InfoT
    >
	void
	format_base<DerivedT,EmbedT,InfoT>::generate(InfoT & info) const
    {     
		DerivedT const* derived_this = static_cast<DerivedT const*>(this);
        if (format_base_access::get(*derived_this))
        {
            format_base_access::get(*derived_this)
                    ->do_generate_virtual(info);
        }
    }


}
